package com.k7k7.sserver;

import com.k7k7.client.UserClientThread;
import com.k7k7.sserver.config.SceneServerConfig;
import com.k7k7.sserver.controlserver.ControlServerThread;
import com.k7k7.sserver.client.ClientS;
import org.apache.log4j.Logger;

public class SceneServer {
	public static Logger log = Logger.getLogger("SceneServer");

	public SceneServer(int clientPort, String controlServerAddress, int controlServerPort) {
		UserClientThread t1;
		try {
			t1 = new UserClientThread(clientPort, ClientS.class);
		} catch (Exception e) {
			return;
		}
		t1.start();
		ControlServerThread t2;
		try {
			t2 = new ControlServerThread(controlServerAddress, controlServerPort);
		} catch (Exception e) {
			t1.interrupt();
			return;
		}
		t2.start();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SceneServerConfig.getConfig(args[0]);
		new SceneServer(SceneServerConfig.clientPort, SceneServerConfig.controlServerAddress, SceneServerConfig.controlServerPort);
	}

}

